
const baseUrl = "https://www.ddandang.top:9000";
//const baseUrl = "http://localhost:9000";
export const loadImageUrl = baseUrl + "/user/upLoadUserAvatar";

export const request = (params) => {
  // // 判断 url中是否带有 /my/ 请求的是私有的路径 带上header token
  // let header = { ...params.header };
  // if (params.url.includes("/my/")) {
  //   // 拼接header 带上token
  //   header["Authorization"] = wx.getStorageSync("token");
  // }
  return new Promise((resolve, reject) => {
    wx.request({
      ...params,
      url: baseUrl + params.url,
      success: (result) => {
        console.log(result);
        resolve(result.data);
      },
      fail: (err) => {
        console.log(err);
        reject(err);
      },
      complete: () => {
      }
    });
  })
}
